package com.ruihu.admin.module.business.tasknode.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruihu.admin.module.business.tasknode.domain.dto.NodeInstConfigValueQueryDTO;
import com.ruihu.admin.module.business.tasknode.domain.dto.NodeInstProcessRelationQueryDTO;
import com.ruihu.admin.module.business.tasknode.domain.entity.NodeInstProcessRelationEntity;
import com.ruihu.admin.module.business.tasknode.domain.vo.NodeInstProcessRelationVO;
import com.ruihu.admin.module.business.tasknode.domain.vo.NodeInstProcessVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * [  ]
 *
 * @author Tony
 * @version 1.0
 * @company 瑞虎（南京）信息技术有限公司
 * @copyright (c)  瑞虎（南京）信息技术有限公司Inc. All rights reserved.
 * @date 2023-01-03 14:55:43
 * @since JDK1.8
 */
@Mapper
@Component
public interface NodeInstProcessRelationDao extends BaseMapper<NodeInstProcessRelationEntity> {

    /**
     * 分页查询
     * @param queryDTO
     * @return NodeInstProcessRelationVO
    */
    List<NodeInstProcessRelationVO> queryByPage(Page page, @Param("queryDTO") NodeInstProcessRelationQueryDTO queryDTO);

    /**
     * 根据id删除
     * @param id
     * @return
    */
    void deleteById(@Param("id")Long id);

    /**
     *
     * @param subTaskNodeInstIdList
     */
    void deleteBySubTaskNodeInstIdList(@Param("subTaskNodeInstIdList") List<Long> subTaskNodeInstIdList);

    /**
     * 根据id批量删除
     * @param idList
     * @return
    */
    void deleteByIdList(@Param("idList") List<Long> idList);


    /**
      * 根据ID更新实体（忽略空值）
      */
    int updateByIdIgnoreEmptyValue(NodeInstProcessRelationEntity entity);

    /**
     * 根据ID更新实体
     */
    int updateById(@Param("entity") NodeInstProcessRelationEntity entity);

    /**
     * 根据子任务实例查询节点元素信息
     * @param subTaskNodeInstIds
     * @return NodeInstProcessVO
     */
    List<NodeInstProcessVO> queryNodeInstProcessList(@Param("subTaskNodeInstIds") List<Long> subTaskNodeInstIds);

    /**
     * 查询固定任务节点配置和数据
     * @param queryDTO
     * @return
     */
    List<NodeInstProcessVO> queryFixedNodeValueList(@Param("queryDTO") NodeInstConfigValueQueryDTO queryDTO);

    /**
     * 查询动态任务节点配置和数据
     * @param queryDTO
     * @return
     */
    List<NodeInstProcessVO> queryDynNodeValueList(@Param("queryDTO") NodeInstConfigValueQueryDTO queryDTO);

    /**
     * 批量更新异常描述
     * @param entities
     */
    void batchUpdateByIds(@Param("entities")List<NodeInstProcessRelationEntity> entities);
}
